//
//  LXSignBlockViewController.m
//  ZuLinProject
//
//  Created by bancheng on 2022/7/13.
//  Copyright © 2022 LX_App. All rights reserved.
//

#import "LXSignBlockViewController.h"

@interface LXSignBlockViewController ()

@end

@implementation LXSignBlockViewController
- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    
    // 禁用侧滑返回
    if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    }
}
- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    // 侧滑返回
    if([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];

    
    if (self.type == 3) {
        [self layoutCustomNav:self.view title:@"续约成功"];
    }
    else if(self.type == 4){
        [self layoutCustomNav:self.view title:@"解约成功"];
    }
    
    
    UIImage *image = [UIImage imageNamed:@"sign成功"];
    UIImageView *iamgeV = [[UIImageView alloc] initWithFrame:CGRectMake((ScreenWidth-image.size.width)/2, kViewTopHeight + 100, image.size.width, image.size.height)];
    iamgeV.image = image;
    [self.view addSubview:iamgeV];
    
    
    UILabel *titleLB = [[UILabel alloc] initWithFrame:CGRectMake(0, iamgeV.Y_height + 20, ScreenWidth, 28)];
    titleLB.textColor = [UIColor colorWithHexString:@"#222222"];
    titleLB.textAlignment = NSTextAlignmentCenter;
    titleLB.font = [UIFont boldSystemFontOfSize:20];
    [self.view addSubview:titleLB];
    if (self.type == 3) {
        titleLB.text = @"续约成功";
        
        UILabel *subTitleLB = [[UILabel alloc] initWithFrame:CGRectMake(0, titleLB.Y_height + 20, ScreenWidth, 50)];
        subTitleLB.textColor = [UIColor colorWithHexString:@"#AAAAAA"];
        subTitleLB.textAlignment = NSTextAlignmentCenter;
        subTitleLB.font = [UIFont systemFontOfSize:14];
        subTitleLB.numberOfLines = 2;
        subTitleLB.text = [NSString stringWithFormat:@"合约结束时间变更为\n%@",self.time];
        [subTitleLB addAttributes:TextAttrCorlor(mainColor) forString:self.time];
        [self.view addSubview:subTitleLB];
        
        
    }
    else if(self.type == 4){
        titleLB.text = @"解约成功";
    }
    
    
    
}

- (void)pop{
    
    if (!StringIsEmpty(self.fromVC)) {
        for (UIViewController *controler in self.navigationController.viewControllers) {
            if ([controler isKindOfClass:NSClassFromString(self.fromVC)]) {
                [self.navigationController popToViewController:controler animated:YES];
                return;
            }
        }
    }
    
    [super pop];
}
@end
